{extend name="public:base"}
{block name="body"}
<body class="pear-container">
	<form class="layui-form layui-form-pane" action="">
        <div class="mainBox">
            <div class="main-container">
                <div class="layui-form-item">
                    <label class="layui-form-label">用户名</label>
                    <div class="layui-input-block">
                        <input type="text" name="username" value="{$info.username|default=''}" lay-verify="require" autocomplete="off"
                            placeholder="请输入标题" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">姓名</label>
                    <div class="layui-input-block">
                        <input type="text" name="nickname" lay-verify="require" value="{$info.nickname|default=''}" autocomplete="off" placeholder="请输入姓名"
                            class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">手机号</label>
                    <div class="layui-input-block">
                        <input type="text" name="mobile" lay-verify="require" value="{$info.mobile|default=''}" autocomplete="off" placeholder="请输入手机号"
                            class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">绑定员工</label>
                    <div class="layui-input-block">
                        <select name="group"  lay-verify="require" lay-search>
                            <option value="">输入可搜索</option>
                            {volist name="ding_user" id="vo"}
                            <option value="{$vo.userid}" {eq name="vo.userid" value="$info['ding_userid']"} selected {/eq} >{$vo.name}</option>
                            {/volist}
                        </select>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">密码</label>
                    <div class="layui-input-block">
                        <input type="text" name="password"  value="" autocomplete="off" placeholder="不修改密码可以为空"
                            class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">确认密码</label>
                    <div class="layui-input-block">
                        <input type="text" name="repassword"  value="" autocomplete="off" placeholder="不修改密码可以为空"
                            class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">角色权限</label>
                    <div class="layui-input-block">
                        <select name="group"  xm-select="group" lay-verify="require">
                            {volist name="auth_group" id="vo"}
                            <option value="{$vo.id}" {present name="info.group"} {in name="vo.id" value="$info['group']"} selected {/in} {/present}>{$vo.showName}</option>
                            {/volist}
                        </select>
                    </div>
                </div>
            </div>
        </div>
            <div class="bottom">
                <div class="button-container">
                    <input type="hidden" name="id" value="{$info.id|default=''}">
                    <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="form-save">
                        <i class="layui-icon layui-icon-ok"></i> 提交
                    </button>
                    <button type="reset" class="pear-btn pear-btn-sm">
                        <i class="layui-icon layui-icon-refresh"></i>
                        重置
                    </button>
                </div>
            </div>
            
    </form>
</body>
{/block} 
{block name="custom"}{/block}
{block name="script"}
<script>
    layui.use(['form','jquery','element','select'], function() {
        let form = layui.form;
        let $ = layui.jquery;
        let select = layui.select;
        form.on('submit(form-save)', function(data) {
            $.ajax({
                url: '{:url("edit")}',
                data: JSON.stringify(data.field),
                dataType: 'json',
                contentType: 'application/json',
                type: 'post',
                success: function(result) {
                    if (result.code == '1') {
                        layer.msg(result.msg, {
                            icon: 1,
                            time: 1000
                        }, function() {
                            parent.layer.close(parent.layer.getFrameIndex(window
                                .name)); //关闭当前页
                            parent.layui.table.reload("table-list");
                        });
                    } else {
                        layer.msg(result.msg, {
                            icon: 2,
                            time: 1000
                        });
                    }
                }
            })
            return false;
        });
    })
</script>
{/block}